package deom1;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String ox = in.next();
        ox = ox.substring(2,ox.length());
        String oo = in.next();
        oo = oo.substring(1,oo.length());
        System.out.print(Integer.valueOf(ox,16)+Integer.valueOf(oo,8));
    }
    public static void main1(String[] args) {
        int i = 1234;
        System.out.println(Integer.toOctalString(i));
        System.out.println(Integer.toHexString(i));

        String str = "6666";
        int c = Integer.valueOf(str,16);
        int d = Integer.valueOf(str,8);
        System.out.println(c);
        System.out.println(d);
        System.out.println(Integer.valueOf(str,8) + Integer.valueOf(str,16));
    }
}
